﻿/**
 *
 * @file SelectSetSurfWidget.h
 * @brief  集合与表面被选取基类对话框实现
 * @author LiBaojun (libaojunqd@foxmail.com)
 * @date 2023-05-25
 *
 */
#ifndef _SELECTSETSURFACE_Widget_H__
#define _SELECTSETSURFACE_Widget_H__

#include "FITK_Kernel/FITKCore/FITKAbstractGUI.h"
#include "GUICalculateWidgetBase.h"

class QTableWidgetItem;

namespace Ui
{
    class SetSurfaceSelectWidget;
}

namespace EventOper {
    class ParaWidgetInterfaceOperator;
}

namespace Interface {
    class FITKAbaAbastractSection;
}

namespace GUI
{
    /**
     * @brief 选取集合与表面选取对话框基类
     * @author LiBaojun (libaojunqd@foxmail.com)
     * @date 2023-05-25
     */
    class GUICalculateDialogAPI SelectSetSurfaceWidgetBase : public GUICalculateWidgetBase
    {
        Q_OBJECT
    public:
        SelectSetSurfaceWidgetBase(EventOper::ParaWidgetInterfaceOperator* oper, QWidget* parent, Interface::FITKAbaAbastractSection* section);
        ~SelectSetSurfaceWidgetBase( );
        /**
         * @brief 更新对话框列表
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2023-05-25
         */
        void updateWidget( );

    protected:
        /**
         * @brief 集合 表面信息
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-04-09
         */
        struct  SetSurfInfo
        {
            int  _modelID{ -1 };
            int _componentID{ -1 };
        };

    protected slots:
        /**
         * @brief continue事件点击事件
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2023-05-25
         */
        void on_continueButton_clicked( );
        /**
         * @brief 取消按钮点击事件
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2023-05-25
         */
        void on_cancelButton_clicked( );
        /**
         * @brief 表格数据被选取
         * @param  item          被选取的数据对象
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2023-05-25
         */
        void on_tableWidget_itemClicked( QTableWidgetItem* item );

        void on_checkBoxHL_stateChanged(int);

    protected:
        /**
         * @brief 往表格中追加行
         * @param  name             名称
         * @param  data             底层数据
         * @param  type             类型，节点集合、单元集合、表面
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2023-05-25
         */
        void initializeTableItem();
        void addTableItem( QString name, SetSurfInfo* data, QString type );
        /**
         * @brief 获取item代表的集合或者表面信息
         * @param  item             列表对象
         * @param  info             集合或者表面信息
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2023-06-06
         */
        void getSetSurfInfo( QTableWidgetItem* item, SetSurfInfo* info );
        /**
         * @brief 是否高亮对象
         * @return true
         * @return false
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2023-07-25
         */
        bool isHighLightItem( );
        /**
         * @brief 获取选中行的item
         * @return QTableWidgetItem*
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2023-07-25
         */
        QTableWidgetItem* getSelectRowItem( );
        /**
         * @brief 取消或者关闭窗口
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2023-07-25
         */
        void reject( ) ;

    protected:
        /**
         * @brief UI 对象
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-04-13
         */
        Ui::SetSurfaceSelectWidget* _ui{ };
        /**
         * @brief 选择类型，节点单元类型与表面等
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-04-13
         */
        int _selectType{ -1 };
    private:
        /* 截面对象*/
        Interface::FITKAbaAbastractSection* _section;
    };
}  // namespace GUI

#endif  // ! _SELECTSETSURFACE_Widget_H__
